window.phoenix&&(window.phoenix.buildInfo||(window.phoenix.buildInfo=[]),-1===window.phoenix.buildInfo.findIndex((e=>"Phoenix-unav"===e.MFE))&&window.phoenix.buildInfo.push({MFE:"Phoenix-unav",VERSION:"rc-phoenix-unav-1.1.7127.1280676399-0e60e6ff-24-g13dabfe",LASTCOMMITDATETIME:"2024-07-18T14:40:54-07:00"})) /*! * * ============= BUILD INFO ============= * MFE: Phoenix-unav * chunkName: component-clientlibs/utility-get-client-unav.v1/utility-get-client-unav * VERSION: rc-phoenix-unav-1.1.7127.1280676399-0e60e6ff-24-g13dabfe * BRANCH: release/fix-unav0722 * COMMITHASH: 13dabfe49c3b891f6dff5d0a3f735594995f7d83 * LASTCOMMITDATETIME: 2024-07-18T14:40:54-07:00 * ============= If you're reading this, why not come work with us? https://www.t-mobile.com/careers ============= */,function(){"use strict";!function(){class e{unavType;unavPartial;instantiatePubSub(e){this.unavType=e,"header"===e?window.phoenix.bus.subscribe("UNAV","CLIENT_UNAV_HEADER",this.getClientUnavPartial.bind(this)):window.phoenix.bus.subscribe("UNAV","CLIENT_UNAV_FOOTER",this.getClientUnavPartial.bind(this))}async getClientUnavPartial(n){if("default"===n.payload&&document.getElementById("defaultUnav"+this.unavType)){const e="header"===this.unavType?"contents":"block";document.getElementById("defaultUnav"+this.unavType).style.display=e,document.getElementById("dynamicUnav"+this.unavType)?.remove()}else{document.getElementById("defaultUnav"+this.unavType)&&document?.getElementById("defaultUnav"+this.unavType)?.remove();const t="/self-service-content/unav."+this.unavType+"."+n.payload+"."+this.unavType+".json";if(!this.unavPartial){const n=await e.fetchClientUnavAPIResponse(t);n&&(this.unavPartial=n.unav)}"header"===this.unavType?window.phoenix.bus.publish("UNAV","CLIENT_UNAV_HEADER_DATA",{payload:this.unavPartial}):"footer"===this.unavType&&window.phoenix.bus.publish("UNAV","CLIENT_UNAV_FOOTER_DATA",{payload:this.unavPartial})}}static async fetchClientUnavAPIResponse(e){const n=await fetch(e,{method:"GET",mode:"cors",cache:"no-cache",credentials:"same-origin",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer"});return await n.json()}}const n={appName:"phoenix-unav",className:"clientUnav"};window.Alpine.data("clientUnav",(()=>({unavType:"",clientId:"default",setPartial(e){const n=document.getElementById("dynamicUnav"+this.unavType);n&&(n.innerHTML=e?.payload);const t=document.getElementById("skeleton_dynamic_unav");t&&t.remove()},init(){if(this.$el?.querySelector("[data-unav-settings]")?.getAttribute("data-unav-type")&&(this.unavType=this.$el?.querySelector("[data-unav-settings]")?.getAttribute("data-unav-type"),this.unavType)){(new e).instantiatePubSub(this.unavType),this.publishClientUnav()}},setClientId(){let e=this.setClientIdFromRequestParam();e||(e=this.setClientIdFromSessionStorage()),e||this.setClientIdFromCookie()},setClientIdFromCookie(){try{const e=window.Cookies.get("tmoUnav")||"{}",n=e?.varient;if(void 0!==n)return this.clientId=n,!0;throw"No varient/variant on tmoUnav cookie"}catch{window.phoenix.log.info("Error reading cookie",n)}return!1},setClientIdFromSessionStorage(){try{const e=JSON.parse(window?.sessionStorage?.getItem("loginSessionInfo")||"{}"),n=e?.userInfo?.profile?.unav?.variant;if(n&&""!==n)return this.clientId=n,!0;throw"No varient/variant on loginSessionInfo"}catch{window.phoenix.log.info("Session info not found",n)}return!1},setClientIdFromRequestParam(){const e=new URLSearchParams(window.location.search);if(e.has("unav")){const n=e.get("unav");if(""!==n)return this.clientId=n,!0}return!1},publishClientUnav(){this.setClientId(),"header"===this.unavType?this.publishHeader(this.clientId):"footer"===this.unavType&&this.publishFooter(this.clientId)},publishHeader(e){window.phoenix.bus.publish("UNAV","CLIENT_UNAV_HEADER",{payload:e}),window.phoenix.bus.subscribe("UNAV","CLIENT_UNAV_HEADER_DATA",this.setPartial.bind(this))},publishFooter(e){window.phoenix.bus.publish("UNAV","CLIENT_UNAV_FOOTER",{payload:e}),window.phoenix.bus.subscribe("UNAV","CLIENT_UNAV_FOOTER_DATA",this.setPartial.bind(this))}})))}()}();